﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PccCommonForC;

public partial class Manager_ProductStore_Inventory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetStore();
            Calendar1.Text = DateTime.Now.ToString("yyyy/MM/01");
            Calendar2.Text = DateTime.Now.ToString("yyyy/MM/dd");
            BindData();
        }
    }

    private void GetStore()
    {
        clsWebShop cls = new clsWebShop();
        PccMsg msg = new PccMsg();
        ddlStore.DataSource = cls.Get_StoreByCondition(msg.GetXmlStr);
        ddlStore.DataTextField = "StName";
        ddlStore.DataValueField = "StID";
        ddlStore.DataBind();
        ddlStore.Items.Insert(0,new ListItem("-- Tất cả --","0",true));
    }


    private void BindData()
    {
        clsWebShop cls=new clsWebShop();
        PccMsg  msg= new PccMsg();
        msg.CreateFirstNode("StID", ddlStore.SelectedValue);
        dtlMaster.DataSource = cls.Get_StoreByCondition(msg.GetXmlStr);
        dtlMaster.DataBind();
    }

    protected void dtlMaster_ItemDataBound(object sender, DataListItemEventArgs e)
    {
    //    adap.SelectCommand.Parameters.Add(new SqlParameter("@StID", msg.Query("StID")));
    //    adap.SelectCommand.Parameters.Add(new SqlParameter("@StartDate", msg.Query("StartDate")));
    //    adap.SelectCommand.Parameters.Add(new SqlParameter("@EndDate", msg.Query("EndDate")));

    //    if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
    //    {
    //        GridView grvMaster = (GridView)e.Item.FindControl("grvMaster");
    //        clsWebShop cls = new clsWebShop();
    ////        cls.Get_StoreDetailByCondition();
            
    //    }
    }
}
